home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Apple II / Programming & Utilities / Apple II Getting down to Basic / SAVER.TEXT.txt < prev    next >
Encoding:
Text File  |  1983-10-25  |  5.4 KB  |  375 lines

  1. %
  2. 3
  3. 10
  4. 1
  5. 38
  6.         SAVING PROGRAMS
  7.  
  8. In the last section, you wrote a 
  9. computer program that prints four
  10. lines of heartfelt verse.
  11. ^
  12. %
  13. 3
  14. 8
  15. 1
  16. 38
  17. To review what your program looks
  18. like, type LIST.
  19. ^
  20. %
  21. 3
  22. 8
  23. 1
  24. 38
  25. There it is!  Your famous first
  26. words.  Right now, your program is
  27. stored in the computer's memory.
  28. ^
  29. %
  30. 3
  31. 10
  32. 1
  33. 38
  34. But if you or some unsuspecting
  35. friend turns off your computer, 
  36. the program will be gone forever, 
  37. or at least gone until you get 
  38. around to retyping it.
  39. ^
  40. &
  41. Rather than having to retype your
  42. programs each time you turn off 
  43. the computer, you can use the SAVE 
  44. command to save your programs on a 
  45. disk.
  46. ^
  47. &
  48. Then, when you're ready to run a 
  49. program, you can use the LOAD 
  50. command to load the program
  51. back into the computer's memory. 
  52. ^
  53. &
  54. When you give the SAVE command,
  55. your computer copies the program
  56. in memory into a file on the disk 
  57. in your disk drive.
  58. ^
  59. &
  60. To keep programs from getting 
  61. mixed up when you store them on 
  62. the disk, you must give each 
  63. program a different name.
  64. ^
  65. %
  66. 3
  67. 9
  68. 1
  69. 38
  70. Let's name your program POEM.  To 
  71. store POEM on the disk, type...
  72.  
  73. SAVE POEM     (and press RETURN)
  74. ^
  75. %
  76. 3
  77. 9
  78. 1
  79. 38
  80. Good job!  You've just saved a
  81. program.  Notice that after you 
  82. give the SAVE command, the disk 
  83. use light turns on.
  84. ^
  85. &
  86. When the light turns off, you know
  87. your program is stored safely on
  88. the disk as well as in the 
  89. computer's memory.
  90. ^
  91. &
  92. Press RETURN for a demonstration
  93. of what happens when you use the
  94. SAVE command.
  95. ^
  96. %
  97. 20
  98. 24
  99. 1
  100. 38
  101. This is a picture of an Apple //c
  102. with an external disk drive.
  103. ^
  104. &
  105. When you write your program, it
  106. goes into the computer's memory.
  107. ^
  108. &
  109. SAVE copies the program in memory
  110. onto the disk in the disk drive.
  111. ^
  112. &
  113. (The //c uses the built-in drive
  114. when there's no external drive.)
  115. ^
  116. &  
  117. In either case, though, the 
  118. program is still in memory.
  119. ^
  120. &
  121. The SAVE command doesn't erase
  122. the computer's memory.
  123. ^
  124. %
  125. 3
  126. 9
  127. 1
  128. 38
  129. But let's say you're basically a
  130. suspicious sort who wants hard
  131. proof that the program is really
  132. on the disk.
  133. ^
  134. &
  135. Well, lucky for you, your disk 
  136. keeps track of all the programs
  137. it contains.  It keeps them in a 
  138. catalog.
  139. ^
  140. %
  141. 3
  142. 10
  143. 1
  144. 38
  145. CAT is the command you use to
  146. display the catalog.  Try it now.
  147. Type...
  148.  
  149. CAT           (and press RETURN)
  150. ^
  151. %
  152. 3
  153. 11
  154. 1
  155. 38
  156. There's the catalog.  As you can
  157. see, you've only saved one
  158. program (POEM) on your simulation
  159. disk so far.  (Don't worry about
  160. the numbers after the names.  They
  161. aren't important right now.)
  162. ^
  163. %
  164. 3
  165. 9
  166. 1
  167. 38
  168. Since your program is now saved
  169. on the disk, you can erase it from
  170. the computer's memory and it will
  171. remain on the disk.
  172. ^
  173. &
  174. You use the NEW command to erase
  175. a program from memory.  It's 
  176. called NEW because it lets you
  177. make room for a new program.
  178. ^
  179. &
  180. Why don't you try it now.  Type
  181.  
  182. NEW         (and press RETURN)
  183. ^
  184. %
  185. 3
  186. 9
  187. 1
  188. 38
  189. There.  Your program is no 
  190. longer in memory.  But don't take 
  191. our word for it. Try running your 
  192. program.
  193. ^
  194. %
  195. 3
  196. 7
  197. 1
  198. 38
  199. Surprise!  Nothing happens because
  200. the program is gone from memory.
  201. ^
  202. &
  203. Press RETURN and we'll show you
  204. what happened to your program.
  205. ^
  206. %
  207. 20
  208. 24 
  209. 38 
  210. Your program was in memory
  211. and was also saved on the disk.
  212. ^
  213. &
  214. When you typed NEW, the program
  215. was erased from memory.
  216. ^
  217. &
  218. However, the copy of the program
  219. on the disk remains.
  220. ^
  221. %
  222. 3
  223. 11
  224. 1
  225. 38
  226. At this point you could start
  227. writing another program.  But 
  228. let's suppose that you're suddenly 
  229. overcome with the desire to make 
  230. your verse even more poetic.
  231. ^
  232. &
  233. Your first task is to get a copy 
  234. of your program from the disk and
  235. put it in the computer's memory.
  236. To do this, you use the LOAD 
  237. command, followed by the name of
  238. the program you want to work on.
  239. ^
  240. %
  241. 3
  242. 9
  243. 1
  244. 38
  245. You saved your program as POEM.
  246. So type:
  247.  
  248. LOAD POEM    (and press RETURN)
  249. ^
  250. %
  251. 3
  252. 9
  253. 1
  254. 38
  255. Excellent!  Your POEM program
  256. is back in memory!  Press RETURN
  257. and we'll show you how it got
  258. there.
  259. ^
  260. %
  261. 20
  262. 24
  263. 1
  264. 38
  265. Your POEM program was saved on
  266. the disk.
  267. ^
  268. &
  269. When you loaded it, a copy of the
  270. program was sent to memory.
  271. ^
  272. &
  273. But notice that the original
  274. program stayed on the disk.
  275. ^
  276. %
  277. 3
  278. 8
  279. 1
  280. 38
  281. Try listing your program now (to
  282. make certain that it's really
  283. there).
  284. ^
  285. %
  286. 3
  287. 9
  288. 1
  289. 38
  290. There it is, the same poem you
  291. saved at the beginning of 
  292. this section. And remember, the
  293. original is still on the disk.
  294. ^
  295. %
  296. 3
  297. 10
  298. 1
  299. 38
  300. Now that your program is back in
  301. memory, why don't you change line
  302. 30 (press RETURN for a hint if you
  303. don't remember how to change a
  304. line).
  305. ^
  306. %
  307. 3
  308. 11
  309. 1
  310. 38
  311. Great job.  Clearly this is a
  312. verse worth saving.  You already
  313. have one program on the disk. If
  314. you were to save this program
  315. under the same name, the new pro-
  316. gram would replace the old one.
  317. ^
  318. %
  319. 3
  320. 9
  321. 1
  322. 38
  323. Because you want to save both
  324. programs, you should save this one
  325. under some other name.  Go ahead,
  326. save your modified poem now.
  327. ^
  328. %
  329. 3
  330. 9
  331. 1
  332. 38
  333. Congratulations!  Now catalog the 
  334. disk just to make sure that both 
  335. poems are tucked away safely on
  336. the disk.
  337. ^
  338. %
  339. 3
  340. 12
  341. 1
  342. 38
  343. Sure enough!  Both programs are
  344. there.  Just one small request
  345. before we go on.  If you ever get
  346. either of these wonderful poems
  347. published, please give Apple 
  348. credit for providing the 
  349. inspiration.
  350. ^
  351. &
  352. You have learned a whole lot so
  353. far.  You now know how to write
  354. and change simple BASIC programs,
  355. how to save them on a disk, how
  356. to check the contents of a disk,
  357. and how to load programs into
  358. memory.
  359. ^
  360. &
  361. At this point, you may want to
  362. continue with the next section, or
  363. you may want to stop and practice
  364. writing and saving some programs
  365. of your own.
  366. ^
  367. &
  368. If you want to practice,
  369. press ESC to go to the menu,
  370. then select Quit.  Otherwise, 
  371. press RETURN to learn more about
  372. programming in BASIC.
  373. ^
  374.